package HomeWork;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class H {
    public static void main(String[] args) {
        Random random = new Random();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<20;i++){
            list.add(random.nextInt(100));
        }
        Collections.sort(list);
        System.out.println("排序后list:"+list);
        List<Integer> subList = list.subList(5,15);
        System.out.println("subList:"+subList);
        for (int i=0;i<10;i++){
            for (int j=0;j<10-i-1;j++){
                if (subList.get(j)<subList.get(j+1)){
                    int min = 0;
                    min = subList.get(j);
                    subList.set(j,subList.get(j+1));
                    subList.set(j+1,min);
                }
            }
        }
        System.out.println("subList从大到小:"+subList);
        System.out.println("最终list:"+list);

    }

}
